package com.music.service.impl;

import com.music.common.BaseResult;
import com.music.dao.CmFormMapper;
import com.music.entity.CmFormCmMusicCmSingerCmUser;
import com.music.service.CmFormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CmFormServiceImpl implements CmFormService {
    @Autowired
    private CmFormMapper cmFormMapper;
    @Override
    public BaseResult findByUid(Integer uId) {
        List<CmFormCmMusicCmSingerCmUser> byUid = cmFormMapper.findByUid(uId);
//        System.out.println(byUid);
        BaseResult baseResult = new BaseResult();
        if (byUid!=null){
            baseResult.setData(byUid);
            baseResult.setCode(200);
            baseResult.setMessage("查询成功");
            return baseResult;
        }else{
            baseResult.setMessage("查询失败");
            baseResult.setCode(201);
            return baseResult;
        }
    }

    @Override
    public BaseResult deleteByfId(Integer fId) {
        int i = cmFormMapper.deleteByfId(fId);
        BaseResult baseResult = new BaseResult();
        if (i!=0){
            baseResult.setMessage("删除成功");
            baseResult.setCode(200);
            return baseResult;
        }else{
            baseResult.setMessage("删除失败");
            baseResult.setCode(201);
            return baseResult;
        }
    }

}
